package ligne2vie.topos.client.asynccalls;

import ligne2vie.topos.client.SimpleMessageBox;
import ligne2vie.topos.client.maps.MyMapWidget;
import ligne2vie.topos.shared.bo.TSummit;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Convenience class making call to a remote service, returning a summit to display.
 * 
 * @author thuguerre
 * @since 1.0.0
 */
public class GetAndDisplaySummit implements AsyncCallback<TSummit> {

	/**
	 * {@inheritDoc}
	 */
	public void onFailure(Throwable caught) {
		new SimpleMessageBox("Echec...", "Impossible de r&eacute;cup&eacute;rer le sommet. "
				+ "Rechargez la page si n&eacute;cessaire.<br /><br />" + caught.getMessage());
	}

	/**
	 * {@inheritDoc}
	 */
	public void onSuccess(TSummit summit) {
		MyMapWidget.getInstance().addSummit(summit);
	}
}